package com.samehope.ar.service.impl;

import com.samehope.ar.entity.SysUserCompany;
import com.samehope.ar.mapper.SysUserCompanyMapper;
import com.samehope.ar.service.ISysUserCompanyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.samehope.ar.vo.CompanyDetailDataVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户公司 服务实现类
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
@Service
public class SysUserCompanyServiceImpl extends ServiceImpl<SysUserCompanyMapper, SysUserCompany> implements ISysUserCompanyService {

    /**
     * 根据企业和用户查找关系
     * @param companyId
     * @param userId
     * @return
     */
    @Override
    public SysUserCompany findByCompanyAndUser(Long companyId, Long userId) {
        return this.baseMapper.findByCompanyAndUser(companyId, userId);
    }

    /**
     * 根据用户查找企业及相关管理员
     * @param userId
     * @return
     */
    @Override
    public List<CompanyDetailDataVO> getCompanyByUser(Long userId){
        return this.baseMapper.getCompanyByUser(userId);
    }
}
